package com.youkeda.meetingroom.controller;

import com.youkeda.meetingroom.model.Result;
import com.youkeda.meetingroom.model.SearchParam;
import com.youkeda.meetingroom.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class SearchController {

    @Autowired
    private SearchService searchService;

    /**
     * 查询
     * @param searchParam
     * @return
     */
    @RequestMapping(value = "/search/find", method = RequestMethod.POST)
    public Result findMeetingRoom(@RequestBody SearchParam searchParam) {
        Result result = new Result();
        if (searchParam != null) {
            result = searchService.findMeetingRoom(searchParam);
        }else{
            result.setSuccess(false);
        }
        return result;
    }

}
